package com.nlx.notes.module.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.nlx.notes.module.bean.vo.flow.GoldSaleSumOverviewVO;
import com.nlx.notes.module.entity.GoldSaleRecordEntity;
import org.apache.ibatis.annotations.Select;

public interface GoldSaleRecordMapper extends BaseMapper<GoldSaleRecordEntity> {


    @Select(" select sum(weight) weight, sum(buy_total_price) buyTotalPrice,sum(sale_total_price) saleTotalPrice,avg(buy_unit_price) buyUnitPrice,avg(sale_unit_price) saleUnitPrice,sum(earnings) totalProfitLoss from  gold_sale_record where user_id =#{userId} and del_flag = 0")
    GoldSaleSumOverviewVO sumByUserId(Long userId);
}
